import api from './index'

// 智能体角色列表查询参数
export interface AgentRolePageRequest {
  page: number
  pageSize: number
  sort?: string
  order?: 'asc' | 'desc'
  keyword?: string
}

// 智能体角色信息
export interface AgentRoleInfo {
  id: number
  name: string
  icon: string
  describe: string
  cueWord: string
  type: number
  status: number
  createdAt: string
  updatedAt: string
}

// 创建智能体角色参数
export interface AgentRoleCreateDTO {
  name: string
  icon: string
  describe: string
  cueWord: string
  type: number
  status: number
}

// 更新智能体角色参数
export interface AgentRoleUpdateDTO {
  id: number
  name: string
  icon: string
  describe: string
  cueWord: string
  type: number
  status: number
}

// 分页响应
export interface PageResponse<T> {
  items: T[]
  total: number
  page: number
  pageSize: number
  totalPage: number
}

/**
 * 获取智能体角色列表
 */
export const getAgentRoleList = async (params: AgentRolePageRequest) => {
  const response = await api.get<any>('/agent/role/page', { params })
  return response
}

/**
 * 创建智能体角色
 */
export const createAgentRole = (data: AgentRoleCreateDTO) => {
  return api.post('/agent/role', data)
}

/**
 * 更新智能体角色
 */
export const updateAgentRole = (data: AgentRoleUpdateDTO) => {
  return api.put('/agent/role', data)
}

/**
 * 删除智能体角色
 */
export const deleteAgentRole = (id: number) => {
  return api.delete(`/agent/role/${id}`)
}

/**
 * 获取智能体角色详情
 */
export const getAgentRoleById = (id: number) => {
  return api.get(`/agent/role/${id}`)
}